#pragma once
#include <base\meta.h>
#include <geometry\primitive.h>

namespace gc {
namespace MPhys {
	class RigidBodyNoRot;

	using RigidBody = RigidBodyNoRot;

    #define a_Gravity 9.8f
	enum PhysicalMaterial { Alluminum, Wood, Iron, Glass, Ivory };  // different from RenderMaterial

	class RigidBodyNoRot {
	public:
		Float mass;
		Point3f position;
		Point3f v;
		Point3f a;
		Point3f a_force;
		Float forceDuration;
		Float e_collision;  // collision coefficient
		PhysicalMaterial material;

		__host__ __device__ RigidBodyNoRot() :mass(0),
			position{ 0,0,0 }, v{ 0,0,0 }, a{ 0,-a_Gravity,0 }, 
			a_force{ 0,0,0 }, forceDuration(0) {}
		__host__  RigidBodyNoRot(Float mass, PhysicalMaterial material);

		__host__ __device__ void move(Float time_delta);

		__host__ __device__ void receiveMomentum(const Point3f &momentum);

		__host__ __device__ void receiveVelocity(const Point3f &dv);

		__host__ __device__ void setForce(const Point3f &force, Float duration);
	};

	__host__ __device__ void collide(const Point3f &n_ab, RigidBodyNoRot &a, RigidBodyNoRot &b);



}
}